package com.dailyblue.javaee.controller;

import com.dailyblue.javaee.service.EmpService;
import com.dailyblue.javaee.service.impl.EmpServiceImpl;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/emp_delete")
public class EmpDeleteController extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        EmpService service = new EmpServiceImpl();
        service.delete(id);
        response.sendRedirect("emp_find_page");
    }
}
